package mythread;


public class ThreadOne {

//    public Integer count = 1;
    public volatile Integer count = 1;


    class One implements Runnable{

        @Override
        public void run() {
            System.out.println("one before="+count);
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            count++;
            System.out.println("one after="+count);
        }
    }

    class Two implements Runnable{

        @Override
        public void run() {
            System.out.println("two before="+count);
            count++;
            System.out.println("two after="+count);
        }
    }


    public static void main(String[] args) {
        ThreadOne threadOne = new ThreadOne();
        new Thread(threadOne.new One()).start();
        new Thread(threadOne.new Two()).start();
    }

}
